package logic

import (
	"context"
	"user-good/model/mysql"

	"user-good/productrpc/internal/svc"
	"user-good/productrpc/productrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodListLogic {
	return &GoodListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 商品列表
func (l *GoodListLogic) GoodList(in *productrpc.GoodListRequest) (*productrpc.GoodListResponse, error) {
	// todo: add your logic here and delete this line

	var good []*productrpc.GoodList

	good = mysql.GoodList(mysql.DB, in.UserId)

	return &productrpc.GoodListResponse{
		List: good,
	}, nil
}
